<?php
include "config/koneksi.php";

$username = $_POST['username'];
$pass     = $_POST['password'];
$who     = $_POST['who'];

$login=mysql_query("SELECT * FROM login WHERE username='$username' AND password='$pass'");
$ketemu=mysql_num_rows($login);
$r=mysql_fetch_array($login);

// Apabila username dan password ditemukan
if ($ketemu > 0){
  session_start();
  
  $_SESSION[namauser]     = $r[username];
  $_SESSION[passuser]     = $r[password];
  $_SESSION[access_level]    = $r[access_level];
  
?>
<script language="javascript" type="text/javascript">
	alert('Login berhasil');
</script>
<meta content="0;adminpage/media.php?module=home" http-equiv="refresh" />
<?php	
}else{
?>
<script language="javascript" type="text/javascript">
	alert('Username atau Password Salah');
</script>
<meta content="0;login.php" http-equiv="refresh" />
<?php  
}
?>
